package com.example.tetris.Tetris;

import ohos.aafwk.ability.Ability;
import ohos.agp.components.Component;
import ohos.agp.render.Canvas;

public class Tetris extends TetrisProperties {

    public Tetris(Ability ability, Component component) {
        super(ability, component);
    }

    public Tetris(Ability ability, Component component, int[][] drawBlock) {
        super(ability, component, drawBlock);
    }


    public void onDraw(Component component, Canvas canvas){
        //这里必须调用超类的onDraw()方法，否则无法执行TetrisBorder类中的onDraw()方法，也就无法绘制边框
        super.onDraw(component,canvas);
        if(drawBlock==null){
            //绘制游戏背景小方格
            drawBlock(canvas,currentBlock,blockCurrentRow,blockCurrentCol);
        }else {
            //绘制下一个方块，drawBlock为
            drawBlock(canvas,drawBlock,0,0);
        }
    }
}